<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * create new admin password
 * get: admin.password.tpl.php
 * used from admin.page.editor.php
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
$idx = $refValidate->testNumber($_POST['idxx'], _('Admin-ID'));
db::getInstance()->where('user_id', intval($idx));
$admin = db::getInstance()->getOne('user');

if ($admin === NULL)
{ // No entry...
	message::setErrorRow(_('Entry not found'), true);
}
else
{
	$refPage->assign('pageTitel', _('New Password for User') . ': ' . $admin['user_name']);

	$refPage->assign('formStart', 'index2.php?page=' . $page . '&sub=' . $subpage . '&func=0');

	$refPage->assign('id', _('Admin-ID') . ': ');
	$refPage->assign('idx', $admin['user_id']);

	$refPage->assign('name', _('Name') . ': ');
	$refPage->assign('namex', $admin['user_name']);

	$refPage->assign('password', _('New password') . ': ');
	$refPage->assign('passwordx', '');

	$refPage->assign('btnSave',
		'<input type="hidden" name="idxx" value="' . $admin['user_id'] . '">' .
		'<input type="hidden" name="psw" value="' . $admin['user_id'] . '">' .
		'<input type="submit" name="submit" id="save" value="' . _('Save') . '" />');
	$refPage->assign('btnAbort',
		'<input type="submit" name="submit" id="abort" value="' . _('Cancel') . '" />');

	$refPage->addtpl('content', '/' . $page . '/' . $subpage . '.password.tpl.php');
}
?>